import Sequelize from 'sequelize';
import baseDao from '../lib/baseDao.js'; // 数据库操作

const Modal = baseDao.sequelize.define('t_goldrecord', {
  // 属性
  id: {
    type: Sequelize.INTEGER,
    primaryKey: true, // 主键
    autoIncrement: true, // 自增
    allowNull: true,
    validate: {
      len: [1, 50]
    }
  },
  userId: {
    type: Sequelize.INTEGER,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '所属用户ID'
  },
  title: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 50]
    },
    comment: '变动内容'
  },
  originGold: {
    type: Sequelize.INTEGER,
    allowNull: true,
    validate: {
      len: [0, 10]
    },
    comment: '变动前金额'
  },
  finalGold: {
    type: Sequelize.INTEGER,
    allowNull: true,
    validate: {
      len: [0, 10]
    },
    comment: '变动后金额'
  },
  change: {
    type: Sequelize.STRING,
    allowNull: true,
    validate: {
      len: [0, 10]
    },
    comment: '变动金额(带+-符号)'
  },
}, {
    // 参数
  });

//向外暴露
export default {
  Modal,
}